package com.medical.admin.hospital.controller;

import com.medical.admin.hospital.common.dto.VisitGuideDto;
import com.medical.admin.hospital.common.vo.PageVo;
import com.medical.admin.hospital.common.vo.VisitGuideVo;
import com.medical.admin.hospital.service.VisitGuideService;
import com.qf.medical.response.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
/**
 * @description: 就诊指南信息管理
 * @author: LuAn
 * @date: 2024/4/27
 */
@Api(tags = "就诊指南管理Api在线文档")
@RestController
@RequestMapping("/visitGuide")
public class VisitGuideController {

    @Resource
    private VisitGuideService visitGuideService;



    @GetMapping("/page")
    @ApiOperation("动态分页查询就诊指南信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "visitGuideTitle", value = "就诊指南"),
            @ApiImplicitParam(name = "pageNum",value = "当前页"),
            @ApiImplicitParam(name = "pageSize",value = "页大小")})
    public ResponseEntity<PageVo<VisitGuideVo>> list(String visitGuideTitle, @RequestParam(defaultValue = "1")
    int pageNum, @RequestParam(defaultValue = "10") int pageSize){
        return ResponseEntity.success(visitGuideService.page(visitGuideTitle,pageNum,pageSize));
    }

    @ApiOperation("新增就诊指南信息")
    @PostMapping("/add")
    @ApiImplicitParam(name = "visitGuideDto",value = "就诊指南信息")
    public ResponseEntity<Integer> add(@RequestBody VisitGuideDto visitGuideDto){
        return ResponseEntity.success(visitGuideService.insert(visitGuideDto));
    }

    @ApiOperation("修改就诊指南信息")
    @PutMapping("/modify")
    @ApiImplicitParam(name = "visitGuideDto" ,value = "就诊指南信息")
    public ResponseEntity<Integer> modify(@RequestBody VisitGuideDto visitGuideDto){
        return ResponseEntity.success(visitGuideService.update(visitGuideDto));
    }

    @ApiOperation("删除就诊指南信息")
    @DeleteMapping("/remove")
    @ApiImplicitParam(name = "visitGuideId" ,value = "就诊指南ID")
    public ResponseEntity<Integer> remove(@NotNull Long visitGuideId){
        return ResponseEntity.success(visitGuideService.delete(visitGuideId));
    }

    @ApiOperation("查询就诊指南信息详情")
    @GetMapping("/detail")
    @ApiImplicitParam(name = "visitGuideId" ,value = "就诊指南ID")
    public ResponseEntity<VisitGuideVo> detail(@NotNull Long visitGuideId){
        return ResponseEntity.success(visitGuideService.select(visitGuideId));
    }


}
